#if !defined(_DBTMEMOFILE_H__INCLUDED_)
#define _DBTMEMOFILE_H__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "MemoFile.h"

// CDBTMemoFile - a Memo File

class TDBFUTILITY_IMPEXP CDBTMemoFile : public CMemoFile
{
	DECLARE_DYNAMIC(CDBTMemoFile)

// Constructors
public:
	CDBTMemoFile();

// Attributes
public:
	DBT_HEAD	m_DBTHead;

// Overridables
public:

// Operations
public:

// Implementation
public:
	~CDBTMemoFile();

	virtual BOOL Open(LPCTSTR lpszName, UINT nOpenFlag);
	virtual void Close();

	virtual UINT GetMemoFileType();

	virtual BOOL ReadMemoRecord(DBF_ULONG lOffsetRec, DBF_LONG& nLen, CTDbfString& strMemo); 
	virtual BOOL ReadMemoRecord(DBF_ULONG lOffsetRec, DBF_LONG& nLen, unsigned char** pMemoData);

	virtual BOOL WriteMemoRecord(DBF_ULONG& lOffsetRec, DBF_LONG& nLen, CTDbfString& strMemo);

#ifdef _DEBUG
	virtual void AssertValid() const;
	virtual void Dump(CDumpContext& dc) const;
#endif

protected:
	BOOL ReadHeader();
	BOOL WriteHeader();

private:

	DBF_LONG AddMemoRecord(CTDbfString& strMemo);

	void UpdateMemoRecord(DBF_ULONG lOffsetRec, CTDbfString& strMemo);

	BOOL DeleteMemoRecord(DBF_ULONG lDelRec);

	BOOL UndeleteMemoRecord(DBF_ULONG& lOffsetRec, CTDbfString& strMemo);

};

//{{AFX_INSERT_LOCATION}}
#endif // !defined(_DBTMEMOFILE_H__INCLUDED_)

